#include<iostream>
using namespace std;
int main()
{
    char s = '0';
    int n = 0;
    int a[100];

    while (1)
    {
        cin >> s;
        if (s == '[' || s == ',')
        {
            cin >> a[n];
            n++;
        }

        else if (s == ']')
            break;
    }
    int max, min;
    max = a[0];
    min = a[0];
    for (int i = 1;i < n;i++)
    {
        if (a[i] > max)
        {
            max = a[i];
        }
    }
    for (int i = 1;i < n;i++)
    {
        if (a[i] < min)
        {
            min = a[i];
        }
    }
    int t = 0;
    for (int j = 0;j < n;j++)
    {
        if (a[j] != max && a[j] != min)
            t++;
    }
    cout << t;
    return 0;
}